package com.qfedu.service.impl;

import com.qfedu.dao.OrderDao;
import com.qfedu.dao.impl.OrderDaoImpl;
import com.qfedu.entity.Address;
import com.qfedu.entity.Cart;
import com.qfedu.entity.Item;
import com.qfedu.entity.Orders;
import com.qfedu.service.OrderService;

import javax.persistence.criteria.Order;
import java.lang.reflect.InvocationTargetException;
import java.math.BigDecimal;
import java.sql.SQLException;
import java.util.Date;
import java.util.List;

public class OrderServiceImpl implements OrderService {
    private OrderDao orderDao = new OrderDaoImpl();
    @Override
    public List<Cart> selectCart(int uid) throws SQLException, InvocationTargetException, IllegalAccessException {
        return orderDao.selectCart(uid);
    }

    @Override
    public List<Address> selectAddress(int uid) throws SQLException {
        return orderDao.selectAddress(uid);
    }

    @Override
    public List<Orders> getOrderListByUid(int uid) throws SQLException, InvocationTargetException, IllegalAccessException {
        return orderDao.getOrderListByUid(uid);
    }

    @Override
    public int addItem(String oid, int pid, BigDecimal icount, int inum) throws SQLException {
        return orderDao.addItem(oid,pid,icount,inum);
    }

    @Override
    public int addOrder(String oid,int uid ,int aid , BigDecimal ocount,String otime, int ostate) throws SQLException {
        return orderDao.addOrder(oid,uid,aid,ocount,otime,ostate);
    }

    @Override
    public Orders queryOrderAddress(String oid) throws SQLException, InvocationTargetException, IllegalAccessException {
        return orderDao.queryOrderAddress(oid);
    }

    @Override
    public List<Item> queryItemInfo(String oid) throws SQLException, InvocationTargetException, IllegalAccessException {
        return orderDao.queryItemInfo(oid);
    }
    @Override
    public int deleteCart(int uid) throws SQLException {
        return orderDao.deleteCart(uid);
    }

    @Override
    public int updateState(int ostate, String oid) throws SQLException {
        return orderDao.updateState(ostate,oid);
    }


}
